package com.wawei.seeds.me;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;

import com.wawei.seeds.R;
import com.wawei.seeds.WalnutMainActivity;
import com.wawei.seeds.adapter.SeedsBaseAdapter;
import com.wawei.seeds.model.WalnutMainEvent;
import com.wawei.seeds.services.ServiceHandler;

import butterknife.InjectView;

/**
 * Created by t27891 on 15/6/22.
 */
public class MeSettingsFragment extends MeBaseFragment {
    @InjectView(R.id.item_settings_exit)View exitBtn;

    @Override
    public View onCreateViewBeforeInjection(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_walnut_me_settings, container, false);
    }

    @Override
    public void onCreateViewAfterInjection(View view, LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    }

    @Override
    public void onViewCreatedAfterTitle(View view, Bundle savedInstanceState) {
        exitBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                exitApp();
            }
        });
    }

    private void exitApp(){
        Intent mainIntent = new Intent(getActivity(), WalnutMainActivity.class);
        mainIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        mainIntent.putExtra(WalnutMainActivity.EXIT, true);
        getActivity().startActivity(mainIntent);
    }

    @Override
    public String getTitle() {
        return getString(R.string.walnut_me_settings);
    }

    @Override
    public ServiceHandler makeServiceHandler() {
        return null;
    }

    @Override
    public SeedsBaseAdapter<WalnutMainEvent> makeListAdapter() {
        return null;
    }

    @Override
    public Bundle makeConditionBundle(int phase) {
        return null;
    }

    @Override
    public Intent makeIntent4ListItemClicked(AdapterView<?> parent, View view, int position, long id, Object itemData) {
        return null;
    }
}
